package acm.蓝桥4;

import java.util.Scanner;

public class 水体2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] chars = sc.nextLine().toCharArray();
        int j=chars.length-1;
        for (int i = chars.length - 2; i >= 0; i--) {
            if (chars[i] == chars[j]) {
                j=i;
            }
            if (chars[j] > chars[i]) {
                char temp = chars[j];
                chars[j] = chars[i];
                chars[i] = temp;
                break;
            }
        }
        System.out.println(new String(chars));
    }
}
